﻿using System.Collections.Generic;
using System.Runtime.Serialization;
using TripLOA.WebService.Wrappers;

namespace TripLOA.WebService.Serializable
{
    [DataContract]
    public class WSTrip : WSObject
    {
        #region Costructors

        /// <summary>
        /// Parameterless Costructor. Set status to "fail"
        /// </summary>
        public WSTrip()
            : this("fail")
        { }

        /// <summary>
        /// Default Costructor. Set status to given value
        /// </summary>
        /// <param name="status">Status string, accepted values are "ok" or "fail"</param>
        public WSTrip(string status)
        {
            this.Status = status;
            this.Payload = new List<TripInfo>();
        }

        /// <summary>
        /// Constructor. Adds to the payload a TripInfo object
        /// </summary>
        /// <param name="status">Status string, accepted values are "ok" or "fail"</param>
        /// <param name="trip">TripInfo object</param>
        public WSTrip(string status, TripInfo trip) : this(status)
        {
            this.Payload.Add(trip);
        }

        #endregion

        #region Properties

        /// <summary>
        /// Payload contains a list of Trip objects
        /// </summary>
        [DataMember]
        public List<TripInfo> Payload { get; set; }

        /// <summary>
        /// Server Cache ID (This is NOT a Trip ID).
        /// </summary>
        public string ID { get; set; }

        #endregion
    }
}
